﻿@using _ViewBag测试.Models
@{
    ViewBag.Title = "ViewBagDome";

}

<table>
    <tr>
        <td colspan="2">解析ViewBag</td>
    </tr>
    <tr>
        <td>所有人名字：</td>
        <td>
            @{
                List<PersonInfo> persons = ViewBag.Persons as List<PersonInfo>;
                string s = string.Join(",", persons.Select(x => x.Name).ToArray());
            }
            @s;
        </td>
    </tr>
    <tr>
        <td>所有人爱好：</td>
        <td>
            @foreach (var item in ViewBag.Persons)
            {
                <p>@item.Hobby,</p>
            }
        </td>
    </tr>
</table>

